const Router = require('koa-router');
const {
  uploadFileController,
  deleteFileController,
  getFileController,
  uploadBatchController,
} = require('../controllers/uploadController');
// 验证身份
const { authMiddleware, authorizeAdmin } = require('../middlewares/authMiddleware')

const router = new Router();

// 处理文件上传的路由
router.post('/upload', authMiddleware, authorizeAdmin, uploadFileController);

// 处理文件删除的路由
router.delete('/files/:id', authMiddleware, authorizeAdmin, deleteFileController);

// 处理文件查询的路由
router.get('/files/:id', authMiddleware, authorizeAdmin, getFileController);

// 批量上传文件的路由
router.post('/upload/batch', authMiddleware, authorizeAdmin, uploadBatchController);

module.exports = router;
